;Esc 映射ESC
Esc::
    ; 如果是 IDEA 先切换输入法、再按ESC
    if WinActive("ahk_exe Code.exe"){
        Send {Blind}{Esc Down}{Esc Up}
        SwitchIME(0x0409) ;; 切換為英文輸入
        Send {Blind}{Esc Down}{Esc Up}
        Return
    }
return
; 输入法切换
SwitchIME(dwLayout){
    HKL:=DllCall("LoadKeyboardLayout", Str, dwLayout, UInt, 1)
    ControlGetFocus,ctl,A
    SendMessage,0x50,0,HKL,%ctl%,A
}